﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page trimDirectiveWhitespaces="true" %>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="Bookmark" href="favicon.ico">
    <link rel="Shortcut Icon" href="favicon.ico"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="<%=request.getContextPath()%>/res/lib/html5.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/res/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/res/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/res/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css"
          href="<%=request.getContextPath()%>/res/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/res/h-ui.admin/skin/default/skin.css"
          id="skin"/>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/res/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/res/css/adminstyle.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script><![endif]-->
    <!--/meta 作为公共模版分离出去-->

    <title>产品分类</title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/res/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css"
          type="text/css">
</head>
<body>
<!--_header 作为公共模版分离出去-->
<header class="navbar-wrapper">
    <div class="navbar navbar-fixed-top">
        <div class="container-fluid cl"><a class="logo navbar-logo f-l mr-10 hidden-xs" href="/aboutHui.shtml">H-ui.admin</a>
            <a class="logo navbar-logo-m f-l mr-10 visible-xs" href="/aboutHui.shtml">H-ui</a> <span
                    class="logo navbar-slogan f-l mr-10 hidden-xs">v3.0</span> <a aria-hidden="false"
                                                                                  class="nav-toggle Hui-iconfont visible-xs"
                                                                                  href="javascript:;">&#xe667;</a>
            <nav class="nav navbar-nav">
                <ul class="cl">
                    <li class="dropDown dropDown_hover"><a href="javascript:;" class="dropDown_A"><i
                            class="Hui-iconfont">&#xe600;</i> 新增 <i class="Hui-iconfont">&#xe6d5;</i></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li><a href="javascript:;" onclick="article_add('添加资讯','article-add.html')"><i
                                    class="Hui-iconfont">&#xe616;</i> 资讯</a></li>
                            <li><a href="javascript:;" onclick="picture_add('添加资讯','picture-add.html')"><i
                                    class="Hui-iconfont">&#xe613;</i> 图片</a></li>
                            <li><a href="javascript:;" onclick="product_add('添加资讯','product-add.html')"><i
                                    class="Hui-iconfont">&#xe620;</i> 产品</a></li>
                            <li><a href="javascript:;" onclick="member_add('添加用户','member-add.html','','510')"><i
                                    class="Hui-iconfont">&#xe60d;</i> 用户</a></li>
                        </ul>
                    </li>
                </ul>
            </nav>
            <nav id="Hui-userbar" class="nav navbar-nav navbar-userbar hidden-xs">
                <ul class="cl">
                    <li>超级管理员</li>
                    <li class="dropDown dropDown_hover"><a href="#" class="dropDown_A">admin <i class="Hui-iconfont">&#xe6d5;</i></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li><a href="javascript:;" onClick="myselfinfo()">个人信息</a></li>
                            <li><a href="#">切换账户</a></li>
                            <li><a href="#">退出</a></li>
                        </ul>
                    </li>
                    <li id="Hui-msg"><a href="#" title="消息"><span class="badge badge-danger">1</span><i
                            class="Hui-iconfont" style="font-size:18px">&#xe68a;</i></a></li>
                    <li id="Hui-skin" class="dropDown right dropDown_hover"><a href="javascript:;" class="dropDown_A"
                                                                               title="换肤"><i class="Hui-iconfont"
                                                                                             style="font-size:18px">&#xe62a;</i></a>
                        <ul class="dropDown-menu menu radius box-shadow">
                            <li><a href="javascript:;" data-val="default" title="默认（黑色）">默认（黑色）</a></li>
                            <li><a href="javascript:;" data-val="blue" title="蓝色">蓝色</a></li>
                            <li><a href="javascript:;" data-val="green" title="绿色">绿色</a></li>
                            <li><a href="javascript:;" data-val="red" title="红色">红色</a></li>
                            <li><a href="javascript:;" data-val="yellow" title="黄色">黄色</a></li>
                            <li><a href="javascript:;" data-val="orange" title="橙色">橙色</a></li>
                        </ul>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</header>
<!--/_header 作为公共模版分离出去-->

<!--_menu 作为公共模版分离出去-->
<aside class="Hui-aside">

    <div class="menu_dropdown bk_2">
        <dl id="menu-article">
            <dt><i class="Hui-iconfont">&#xe616;</i> 资讯管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a href="article-list.html" title="资讯管理">资讯管理</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-picture">
            <dt><i class="Hui-iconfont">&#xe613;</i> 图片管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a href="picture-list.html" title="图片管理">图片管理</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-product">
            <dt class="selected"><i class="Hui-iconfont">&#xe620;</i> 产品管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i>
            </dt>
            <dd style="display: block;">
                <ul>
                    <li><a href="product-brand.html" title="品牌管理">品牌管理</a></li>
                    <li class="current"><a href="product-category.html" title="分类管理">分类管理</a></li>
                    <li><a href="product-list.html" title="产品管理">产品管理</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-comments">
            <dt><i class="Hui-iconfont">&#xe622;</i> 评论管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a href="http://h-ui.duoshuo.com/admin/" title="评论列表">评论列表</a></li>
                    <li><a href="feedback-list.html" title="意见反馈">意见反馈</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-member">
            <dt><i class="Hui-iconfont">&#xe60d;</i> 会员管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a href="member-list.html" title="会员列表">会员列表</a></li>
                    <li><a href="member-del.html" title="删除的会员">删除的会员</a></li>
                    <li><a href="member-level.html" title="等级管理">等级管理</a></li>
                    <li><a href="member-scoreoperation.html" title="积分管理">积分管理</a></li>
                    <li><a href="member-record-browse.html" title="浏览记录">浏览记录</a></li>
                    <li><a href="member-record-download.html" title="下载记录">下载记录</a></li>
                    <li><a href="member-record-share.html" title="分享记录">分享记录</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-admin">
            <dt><i class="Hui-iconfont">&#xe62d;</i> 管理员管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a href="admin-role.html" title="角色管理">角色管理</a></li>
                    <li><a href="admin-permission.html" title="权限管理">权限管理</a></li>
                    <li><a href="admin-list.html" title="管理员列表">管理员列表</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-tongji">
            <dt><i class="Hui-iconfont">&#xe61a;</i> 系统统计<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a href="charts-1.html" title="折线图">折线图</a></li>
                    <li><a href="charts-2.html" title="时间轴折线图">时间轴折线图</a></li>
                    <li><a href="charts-3.html" title="区域图">区域图</a></li>
                    <li><a href="charts-4.html" title="柱状图">柱状图</a></li>
                    <li><a href="charts-5.html" title="饼状图">饼状图</a></li>
                    <li><a href="charts-6.html" title="3D柱状图">3D柱状图</a></li>
                    <li><a href="charts-7.html" title="3D饼状图">3D饼状图</a></li>
                </ul>
            </dd>
        </dl>
        <dl id="menu-system">
            <dt><i class="Hui-iconfont">&#xe62e;</i> 系统管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt>
            <dd>
                <ul>
                    <li><a href="system-base.html" title="系统设置">系统设置</a></li>
                    <li><a href="system-category.html" title="栏目管理">栏目管理</a></li>
                    <li><a href="system-data.html" title="数据字典">数据字典</a></li>
                    <li><a href="system-shielding.html" title="屏蔽词">屏蔽词</a></li>
                    <li><a href="system-log.html" title="系统日志">系统日志</a></li>
                </ul>
            </dd>
        </dl>
    </div>
</aside>
<div class="dislpayArrow hidden-xs"><a class="pngfix" href="javascript:void(0);" onClick="displaynavbar(this)"></a>
</div>
<!--/_menu 作为公共模版分离出去-->

<section class="Hui-article-box" style="overflow-y: scroll;">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 产品管理 <span
            class="c-gray en">&gt;</span> 产品分类 <a class="btn btn-success radius r"
                                                  style="line-height:1.6em;margin-top:3px"
                                                  href="javascript:location.replace(location.href);" title="刷新"><i
            class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="Hui-article">
        <article class="cl pd-20">
            <table style="margin: 0 auto; " class="tb tb2">
                <tbody>
                <tr class="header">
                    <th></th>
                    <th>显示顺序</th>
                    <th>类别名称&nbsp;<a href="#" onclick="addrow('group_xin',this,1,0,0)" class="addtr">添加一级分类</a></th>
                    <th>类别URL</th>
                    <th>类别编号</th>
                    <th>创建时间</th>
                    <th>批量操作</th>
                </tr>
                <%--循环一级类别--%>
                <c:forEach items="${result.YJLX}" var="YJLX" varStatus="status">

                <tr class="hover" style="background: #eb82821a;">
                    <td class="td25" onclick="toggle_group('.group_${YJLX.YJLXID}', '#a_group_${YJLX.YJLXID}')"><a
                            href="javascript:;"
                            id="a_group_${YJLX.YJLXID}">[-]</a></td>
                    <td ondblclick="ShowElement(this,1,${YJLX.YJLXID},'SXID')">${YJLX.YJSXID}</td>
                    <td ondblclick="ShowElement(this,1,${YJLX.YJLXID},'LXMC')">${YJLX.YJLXMC}</td>
                    <td ondblclick="ShowElement(this,1,${YJLX.YJLXID},'LXURL')">${YJLX.YJLXURL}</td>
                    <td><span>(id:${YJLX.YJLXID})</span>&nbsp;${YJLX.YJLXBH}</td>
                    <td>${YJLX.YJCJSJ}</td>
                    <td><input class="checkbox" value="1" type="checkbox" name="gc1" onclick="checkAll()"><a
                            href="" onclick="daleterow(1,${YJLX.YJLXID})">删除</a></td>
                </tr>
                </tbody>
                <tbody>
                 <%--循环二级类别--%>
                <c:forEach items="${result.EJLX}" var="EJLX">
                    <c:if test="${YJLX.YJLXID==EJLX.YJLXID}">
                        <tr class="hover group_${YJLX.YJLXID}"  style="background: #e1ef051a;">
                            <td class="td25"></td>
                            <td class="td25" ondblclick="ShowElement(this,2,${EJLX.EJLXID},'SXID')">${EJLX.EJSXID}</td>
                            <td>
                                <div class="board"><span ondblclick="ShowElement(this,2,${EJLX.EJLXID},'LXMC')">${EJLX.EJLXMC}</span><a
                                        href="#" onclick="addrow('group_${EJLX.YJLXID}',this,3,${EJLX.EJLXID})"
                                        class="addchildboard">添加三级分类</a>
                                </div>
                            </td>
                            <td ondblclick="ShowElement(this,2,${EJLX.EJLXID},'LXURL')">${EJLX.EJLXURL}</td>
                            <td><span>(id:${EJLX.EJLXID})</span>&nbsp;${EJLX.EJLXBH}</td>
                            <td>${EJLX.EJCJSJ}</td>
                            <td><input class="checkbox" value="1" type="checkbox" name="gc1" onclick="checkAll()"><a
                                    href="" onclick="daleterow(2,${EJLX.EJLXID})">删除</a></td>
                        </tr>
                        <%--循环三级类别--%>
                        <c:forEach items="${result.SJLX}" var="SJLX">
                            <c:if test="${EJLX.EJLXID==SJLX.EJLXID}">
                                <tr class="hover group_${YJLX.YJLXID} zigroup_${YJLX.YJLXID}" style="background: #a6eb821a;">
                                    <td class="td25"></td>
                                    <td class="td25" ondblclick="ShowElement(this,3,${SJLX.SJLXID},'SXID')">${SJLX.SJSXID}</td>
                                    <td>
                                        <div class="childboard" ondblclick="ShowElement(this,3,${SJLX.SJLXID},'LXMC')">${SJLX.SJLXMC}</div>
                                    </td>
                                    <td ondblclick="ShowElement(this,3,${SJLX.SJLXID},'LXURL')">${SJLX.SJLXURL}</td>
                                    <td><span>(id:${SJLX.SJLXID})</span>&nbsp;${SJLX.SJLXBH}</td>
                                    <td>${SJLX.SJCJSJ}</td>
                                    <td><input class="checkbox" value="1" type="checkbox" name="gc1"
                                               onclick="checkAll()"><a href="" onclick="daleterow(3,${SJLX.SJLXID})">删除</a></td>
                                </tr>
                            </c:if>
                        </c:forEach>
                    </c:if>
                </c:forEach>


                <tr>
                    <td></td>
                    <td colspan="4">
                        <div class="lastboard"><a href="#" onclick="addrow('group_${YJLX.YJLXID}',this,2,${YJLX.YJLXID})"
                                                  class="addtr">添加二级分类</a></div>
                    </td>
                    <td>&nbsp;</td>
                </tr>
                </tbody>
                </c:forEach>


            </table>


        </article>
    </div>
</section>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="<%=request.getContextPath()%>/res/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/res/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/res/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/res/h-ui.admin/js/H-ui.admin.page.js"></script>
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="<%=request.getContextPath()%>/res/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript"
        src="<%=request.getContextPath()%>/res/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/res/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript"
        src="<%=request.getContextPath()%>/res/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="application/javascript">
    $(function () {


    });

    //显示隐藏子版块
    function toggle_group(group, a_group) {
        var display = $(a_group).html();
        //显示
        if (display == "[+]") {
            $(group).css("display", "table-row");
            $(a_group).html("[-]");
        } else {
            $(group).css("display", "none");
            $(a_group).html("[+]");
        }
    }
    //删除类别
    function daleterow(dqlx,dqid){
        $.ajax({
            url:"daleteadminProductType.do",
            contentType: "application/json; charset=utf-8",
            data:JSON.stringify({"dqlx":dqlx,"dqid":dqid}),
            type:"post",
            dataType: "json",
            success:function(data){
                if(data==1){
                    layer.alert('删除成功！', {icon: 6});
                    window.location.reload();
                }else{
                    layer.alert('删除失败！', {icon: 5});
                }
            }
        });
    }
    //保存类别
    function saverow(group,shangji,sjlx,dqlx){
       var SXID=$("#XIN_LXSX").html();
       var LXMC=$("#XIN_LXMC").html();
       var LXURL=$("#XIN_LXURL").html();
        $.ajax({
            url:"addadminProductType.do",
            contentType: "application/json; charset=utf-8",
            data:JSON.stringify({"sjlx":sjlx,"dqlx":dqlx,"sxid":SXID,"lxmc":LXMC,"lxurl":LXURL}),
            type:"post",
            dataType: "json",
            success:function(data){
                if(data==1){
                    layer.alert('保存成功！', {icon: 6});
                    window.location.reload();
                }else{
                    layer.alert('保存失败！', {icon: 5});
                }
            },
            error: function (XMLHttpRequest,result,errorThrown) {
                alert(XMLHttpRequest.status);
                alert(XMLHttpRequest.readyState);
                alert(result);
            }
        });
    }

    //添加类别  当前id，当前操作元素，添加元素级别，上级级别
    function addrow(group, current, lxid,sjlx) {
        if ($("#xin").html() != undefined) {
            layer.alert('请完成当前新增操作！', {icon: 6});
            window.location.href = "#xin";
            return false;
        }

        if (lxid == 1) {
            //添加一级类别
            $(current).parent().parent().parent().parent().append("<tbody><tr id='xin' class=\"hover\" style=\"background: #eb82821a;\"> " +
                "      <td class=\"td25\" onclick=\"toggle_group('.group_xin', '#a_group_xin')\"><a\n" +
                "              href=\"javascript:;\"\n" +
                "              id=\"a_group_xin\">[-]</a></td>\n" +
                "      <td id=\"XIN_LXSX\" ondblclick=\"ShowElement(this,1,-1,'SXID')\">0</td>\n" +
                "      <td id=\"XIN_LXMC\"ondblclick=\"ShowElement(this,1,-1,'LXMC')\">新类别名称</td>\n" +
                "      <td id=\"XIN_LXURL\"ondblclick=\"ShowElement(this,1,-1,'LXURL')\">新类别URL</td><td><a class=\"btn btn-primary radius\" onclick=\"saverow(this,0,"+sjlx+",1)\" href=\"javascript:;\"> 保存</a></td><td></td>\n" +
                "      <td><input class=\"checkbox\" value=\"1\" type=\"checkbox\" name=\"gc1\" onclick=\"checkAll()\"><a\n" +
                "              href=\"\">删除</a></td>\n" +
                "      </tr></tbody><tbody>\n" +
                "                 <tr>\n" +
                "                    <td></td>\n" +
                "                    <td colspan=\"4\">\n" +
                "                        <div class=\"lastboard\"><a href=\"\" onclick=\"addrow('group_xin',this,2)\" class=\"addtr\">添加二级分类</a></div>\n" +
                "                    </td>\n" +
                "                    <td>&nbsp;</td>\n" +
                "                </tr>\n" +
                "                </tbody>");


        } else if (lxid == 2) {
            //添加二级类别
            $(current).parent().parent().parent().before("<tr id=\"xin\" class=\"hover " + group + " EJ" + group + "\" style=\"background: #e1ef051a;\"> " +
                "        <td class=\"td25\"></td>\n" +
                "        <td id=\"XIN_LXSX\" class=\"td25\" ondblclick=\"ShowElement(this,2,-1,'SXID')\">0</td>\n" +
                "        <td>\n" +
                "            <div class=\"board\" ><span id=\"XIN_LXMC\" ondblclick=\"ShowElement(this,2,'-1','LXMC')\">新二级类别名称</span><a href=\"\"onclick=\"addrow('" + group + "', this,3)\"class=\"addchildboard\">添加三级分类</a>\n" +
                "            </div>\n" +
                "        </td>\n" +
                "        <td id=\"XIN_LXURL\" ondblclick=\"ShowElement(this,2,'-1','LXURL')\">新二级类别URL</td>\n" +
                "        <td><a class=\"btn btn-primary radius\" onclick=\"saverow(this,2,"+sjlx+",2)\" href=\"javascript:;\"> 保存</a></td>\n" +
                "        <td></td>\n" +
                "        <td><input class=\"checkbox\" value=\"1\" type=\"checkbox\" name=\"gc1\" onclick=\"checkAll()\"><a href=\"\">删除</a></td>" +
                "        </tr>");
        }
        else if (lxid == 3) {
            //添加三级类别
            $(current).parent().parent().parent().after("<tr id=\"xin\" class=\"hover " + group + " SJ" + group + "\" style=\"background: #a6eb821a;\">" +
                "                    <td class=\"td25\"></td>\n" +
                "                    <td id=\"XIN_LXSX\"class=\"td25\" ondblclick=\"ShowElement(this,2,-1,'SXID')\">0</td>\n" +
                "                    <td>\n" +
                "                    <div id=\"XIN_LXMC\" class=\"childboard\" ondblclick=\"ShowElement(this,2,'-1','LXMC')\">新三级类别名称</div>\n" +
                "                    </td>\n" +
                "                    <td id=\"XIN_LXURL\" ondblclick=\"ShowElement(this,2,'-1','LXURL')\">新三级类别URL</td>\n" +
                "                    <td><a class=\"btn btn-primary radius\" onclick=\"saverow(this,3,"+sjlx+",3)\" href=\"javascript:;\"> 保存</a></td>\n" +
                "                    <td></td>\n" +
                "                    <td><input class=\"checkbox\" value=\"1\" type=\"checkbox\" name=\"gc1\" onclick=\"checkAll()\"><a href=\"\">删除</a></td>" +
                "                    </tr>");
        }
        window.location.href = "#xin";
    }
    //双击可编辑 当前操作对象,级别,类型ID,字段名
    function ShowElement(element,jibie,lxid,ziduan) {
        var oldhtml = element.innerHTML;     //创建新的input元素
        var newobj = document.createElement('input');     //为新增元素添加类型
        newobj.style = "width: 100px;";
        newobj.type = 'text';     //为新增元素添加value值
        newobj.value = oldhtml;     //为新增元素添加光标离开事件
        newobj.onblur = function () {
            element.innerHTML = this.value == oldhtml ? oldhtml : this.value; //当触发时判断新增元素值是否为空，为空则不修改，并返回原有值
            //$(element).html()
               $.ajax({
                   url:"updateadminProductType.do",
                   contentType: "application/json; charset=utf-8",
                   data:JSON.stringify({"jibie":jibie,"lxid":lxid,"ziduan":ziduan,"value":this.value}),
                   type:"post",
                   dataType: "json",
                   success:function(data){
                       if(data==1){
                           //alert("保存成功！");
                       }else{
                           //alert("保存失败！");
                       }
                   },
                   error: function (XMLHttpRequest,result,errorThrown) {
                       alert(XMLHttpRequest.status);
                       alert(XMLHttpRequest.readyState);
                       alert(result);
                   }
               });

        };    //设置该标签的子节点为空
        element.innerHTML = '';    //添加该标签的子节点，input对象
        element.appendChild(newobj);     //设置选择文本的内容或设置光标位置（两个参数：start,end；start为开始位置，end为结束位置；如果开始位置和结束位置相同则就是光标位置）
        newobj.setSelectionRange(0, oldhtml.length);
        //设置获得光标
        newobj.focus();

    }

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>